$('.right-titleicon').on("click", function(e) {
	projectVM.showMenulist()
})

projectVM = new Vue({
	el: "#content",
	data: {
		orgList:[],
		errRecord:'',
		checkItemname:'',
		showAdditem:false,
		back:false,
		questionArrary:[],
		lifeWaterId:'',
		nowDate:'',
		delNeiosLifeWaterInfo:[],
		neiosLifeWater:'',
		neiosLifeWaterInfo:[],
		neiosCheckItemNoteList:[],
		statusSelect:[],
		checkResultTypeList:[],
		deviceState:[],
		approveDesc: '',
		approveDialogTips: true,
		isApprove: false,
		isMyEditor: false,
		workStatus: '20',
		dealingPerson: 'P129951',
		// 是否是编辑
		isEdit: false,
		// 编辑对应行
		index: 0,
		approveCodeName: '',
		workDesc: '',
		workType: '0113',
		// 流程id
		workId: "", // 获取流程日志所需待办Id
		addOrEdit: false,
		isEditor: false,
		initNetSafeDeviceInfoList: [],
		formData: {
			deviceName:'',
			deviceCode:'',
			neiosCheckItemNoteList:[]
		},
		onStatus: false,
		showPop: false,
		showMenu: false,
		showAdd: false,
		elseDesc: '',
		//删除数据
		delNetSafeDeviceInfoList: [],
		networkSafe: {
			"networkSafeId": "",
			"workId": "",
			"workDesc": "网络安全防护设备定期检查",
			"elseDesc": ""
		},
		defectInfoList: [],
		menuList: [{
			name: '新增',
			path: 'list.html'
		}, {
			name: '列表',
			path: 'index.html'
		}, ],
		filterText: 'all', //筛选条件
		list: [],
		currentUser: {},
	},
	components: {
		personselect,
		processlog
	},
	created() {
		this.workId = JSON.parse(localStorage.getItem('todoWork')).obj.workId
		this.workDesc = JSON.parse(localStorage.getItem('todoWork')).obj.workDesc
		this.workStatus = JSON.parse(localStorage.getItem('todoWork')).obj.workStatus
		this.currentUser = JSON.parse(localStorage.getItem('neiosUser'))
		if (this.workStatus == '20') {
			this.isMyEditor = true
		}
		let dictCodes =
			'DEVICE_STATE,YES_OR_NO';
		let dict = mui.neiosCommon.queryDict(dictCodes, (data) => {
			if (data != '') {
			this.statusSelect = data.DEVICE_STATE;
            this.checkResultTypeList = data.YES_OR_NO;
            this.deviceState = data.DEVICE_STATE;
			}
		})
		this.getOrgList()
		this.getList()
		this.getNowdate()
	},
	beforeDestroy() {
	},
	methods: {
		//获取默认检查项
		getOrgList(){
			var that = this
			//列表
				let param = {
					currentUser:this.currentUser,
					workType:'0113'
				}
				mui.neiosRequst.httpRequst('/app/regularWork/lifeWater/getCheckItemsByOrgs', param,
				function(data){
					that.orgList = data.data
					
				},
				function(data){
					
				}
				)
		},
		//获取列表
		getList(){
			var _this = this
		//列表
			let param = {
				"workId": this.workId
			}
			mui.neiosRequst.httpRequst('/app/regularWork/lifeWater/getLifeWaterInfoByWorkId', param,
			function(data){
				// console.log(JSON.stringify(data
			  if(data.lifeWater != null) {
				_this.neiosLifeWater = data.lifeWater;
				_this.lifeWaterId = data.lifeWater.lifeWaterId;
				_this.neiosLifeWaterInfo = data.lifeWaterInfoList;
				_this.checkItems = data.lifeWaterInfoList[0].neiosCheckItemNoteList;
				}else {
				_this.getNewLifeWater();

			}
			},
			function(){
				
			}
		);	
		},
		//获取当前时间
		getNowdate() {
			var date = new Date()
			var year = date.getFullYear()
			var month = date.getMonth()
			var day = date.getDate()
			var hour = date.getHours()
			var min = date.getMinutes()
			 var sec = date.getSeconds()
			month = month*1 + 1
			if (month.toString().length < 2) {
				month = '0' + month
			}
			if (day.toString().length < 2) {
				day = '0' + day
			}
			if (hour.toString().length < 2) {
				hour = '0' + hour
			}
			if (min.toString().length < 2) {
				min = '0' + min
			}
			if (sec.toString().length < 2) {
				sec = '0' + sec
			}
			this.nowDate = year + '-' + month + '-' + day + ' ' + hour + ':' + min +':' + sec	
		},
		//查询最新提交的工具信息
		getNewLifeWater(){
			var _this = this
			//列表
				let param = {
					
				}
				mui.neiosRequst.httpRequst('/app/regularWork/lifeWater/getNewLifeWater', param,
				function(data){
					  if (data.code == "0") {
						
						if (data.data.length>0) {

                        _this.neiosLifeWaterInfo =data.data;

                        _this.checkItems = _this.neiosLifeWaterInfo[0].neiosCheckItemNoteList?_this.neiosLifeWaterInfo[0].neiosCheckItemNoteList : [];
						
                        _this.oldNeiosLifeWaterInfo = _this.neiosLifeWaterInfo
						
                        _this.neiosLifeWaterInfo.forEach(item => {

                            item.flag = 'newSave';// 新增的标记（用来解决页面新增后再删除 出现脏数据的问题）

                            item.lifeWaterInfoId = _this.lifeWaterId

                            item.client = 'NEIOS';// 客户id

                            item.dataSource = 'NEIOS_APP'+localStorage.getItem("currVersion");// 数据来源

                            item.dataStatus = '1';// 数据状态

                            item.createBy = _this.currentUser.userId;// 创建人

                            item.createDate = _this.nowDate//创建时间

                            item.createStaffName = _this.currentUser.name;//创建人姓名

                            item.modifyBy = _this.currentUser.userId;//修改人

                            item.modifyDate = _this.nowDate;//修改时间

                            item.modifyStaffName = _this.currentUser.name;//修改人姓名

                            item.checkDate = _this.nowDate;

                            item.defectDesc = '';// 带出的历史生活消防水不要结论

                            item.deviceState = '';

                            item.neiosCheckItemNoteList.forEach(CheckItemNote => { // 带出的历史生活消防水不要检查项的是否符合要求

                                CheckItemNote.checkItemResult = '';

                            });

                        });

                    }

                    _this.tableLoading = false;

                } else {

                    _this.$message({

                        message: _this.$t('获取数据失败'),

                        type: 'warning'

                    });

                    _this.tableLoading = false;

                }

				},
				function(){
					
				})
		},
		//组件冒泡
		clickStop() {

		},
		//判断是否显示办理
		isShowHandle() {
			if (this.workStatus == '30') {
				return true
			} else {
				return false
			}
		},
		//判断是否显示编辑
		isShowEdit() {
			if (this.workStatus == '20') {
				return true
			} else {
				return false
			}
		},
		// 删除
		del(item, index) {
			var btnArray = ['取消', '确定'];
			mui.confirm('是否确认删除？', '提示', btnArray, (e) => {
				if (e.index == 1) {
					this.list.splice(index, 1)
					if (item.networkSafeInfoId != null && typeof(item.networkSafeInfoId) != "undefined" && item.networkSafeInfoId !=
						"") {
						this.delNetSafeDeviceInfoList.push(item);
					}
				} else {

				}
			})

		},
		//新增检查项目
		showaddItem(){
			if(this.formData.deviceCode == ''){
				mui.toast('请输入设备编号')
				return
			}
			else if(this.formData.deviceName == ''){
				mui.toast('请输入设备名称')
				return
			}
			this.showAdditem = true
			
		},
		delCheckitem(e){
			this.formData.neiosCheckItemNoteList.splice(e,1)
		},
		addItem(){
			if(this.checkItemname == ''){
				mui.toast('请输入检查项目')
			}
			var item = {
				"checkItemNoteId": '',
				"busiInfoId": "",
							"configDetailedId": null,
							"workType": null,
							"checkItemContent": this.checkItemname,
							"checkItemRequirement": this.errRecord,
							"checkItemResult": "",
							"itemSolveStaffCode": null,
							"itemSolveStaffName": null,
							"problemLog": null,
							"headquartersDetailedId": null,
							"parentDetailedId": null,
							"remark": "",
							"client": "NEIOS",
							"dataSource": "NEIOS_APP"+localStorage.getItem("currVersion"),
							"status": "32",
							"dataStatus": "1",
							"createBy": this.currentUser.userId,
							"createStaffName": this.currentUser.name,
							"createDate": this.nowDate,
							"modifyBy": this.currentUser.userId,
							"modifyStaffName": this.currentUser.name,
							"modifyDate": this.nowDate,
							"reserveField1": "",
							"reserveField2": "",
							"reserveField3": "",
							"reserveField4": "",
							"reserveField5": "",
							"orgCode": this.currentUser.stationNewCode,
							"defectInfoDesc": null
			}
			this.formData.neiosCheckItemNoteList.push(item)
			this.showAdditem =false
			this.checkItemname = ''
			this.errRecord = ''
		},
		// 新增添加
		addList(item,index) {
			var _this = this
			if (!this.formData.deviceName) {
				mui.toast("请输入设备名称");
				return
			} else if (!this.formData.deviceCode) {
				mui.toast("请输入设备编号");
				return
			}
			var arr = this.formData.neiosCheckItemNoteList
			var able = true
			arr.forEach(e=>{
				if(!e.checkItemResult){
					able = false
				}
			})
			if(!able || arr.length == 0){
				mui.toast('请完成检查选项')
				return
			}
				if(!this.isEdit){
					_this.formData.flag = 'newSave';// 新增的标记（用来解决页面新增后再删除 出现脏数据的问题）
					
					 _this.formData.lifeWaterInfoId = mui.neiosCommon.getUuidv4()
					 
					 
				}
				_this.formData.neiosCheckItemNoteList.forEach(checkItemNote => {
						
				    checkItemNote.checkItemNoteId = mui.neiosCommon.getUuidv4()//主键id
						
				    checkItemNote.busiInfoId =  _this.formData.lifeWaterInfoId;// 关联的明细id
						
				    checkItemNote.orgCode = _this.currentUser["stationNewCode"];
						
				    checkItemNote.WorkType = '0113';
						
				    checkItemNote.client = 'NEIOS';// 客户id
						
				    checkItemNote.dataSource = 'NEIOS_APP'+localStorage.getItem("currVersion");// 数据来源
						
				    checkItemNote.status = '21';
						
				    checkItemNote.dataStatus = '1';// 数据状态
						
				    checkItemNote.createBy = _this.currentUser["userId"];// 创建人
						
				    checkItemNote.createDate = this.nowDate;//创建时间
						
				    checkItemNote.createStaffName = _this.currentUser["name"];//创建人姓名
						
				    checkItemNote.modifyBy = _this.currentUser["userId"];//修改人
						
				    checkItemNote.modifyDate = this.nowDate;//修改时间
						
				    checkItemNote.modifyStaffName = _this.currentUser["name"];//修改人姓名
						
				});
                    _this.formData.client = 'NEIOS';// 客户id

                    _this.formData.dataSource = 'NEIOS_APP'+localStorage.getItem("currVersion");// 数据来源

                    _this.formData.dataStatus = '1';// 数据状态

                    _this.formData.createBy = _this.currentUser.userId;// 创建人

                    _this.formData.createDate = this.nowDate//创建时间

                    _this.formData.createStaffName = _this.currentUser["name"];//创建人姓名

                    _this.formData.modifyBy = _this.currentUser["userId"];//修改人

                    _this.formData.modifyDate = this.nowDate;//修改时间

                    _this.formData.modifyStaffName = _this.currentUser["name"];//修改人姓名
						
					if(this.isEdit){
						this.neiosLifeWaterInfo[this.index] = JSON.parse(JSON.stringify(this.formData))
					}
					else{
						this.neiosLifeWaterInfo.push(this.formData)
					}
					
					console.log(JSON.stringify(this.neiosLifeWaterInfo))
					// return
					this.clearFormateData()
			
		},
		// 清楚编辑信息
		clearFormateData() {
			this.addOrEdit = false
			this.formData = {
				deviceName:'',
				deviceCode:'',
				neiosCheckItemNoteList:[]
			}
		},
		//新增设备
		add() {
			
			this.clearFormateData()
			this.isEdit = false
			this.addOrEdit = true
			this.formData.checkDate = this.nowDate
			this.formData.checkStaffCode = this.currentUser.userId
			this.formData.checkStaffName = this.currentUser.name
			this.formData.checkStaffCodeName = '[' + this.currentUser.userId + ']' + this.currentUser.name
			this.formData.dataSource = 'NEIOS_APP'+localStorage.getItem("currVersion")
			var arr = []
			// if(this.checkItems){
			// 	this.checkItems.forEach(e=>{
			// 		let checkItemNote = {
			// 			"checkItemContent": e.checkItemContent,
			// 			"checkItemRequirement":e.checkItemRequirement,
			// 			"orgCode":e.orgCode
			// 		}
			// 		arr.push(checkItemNote)
			// 	})
			// }
			this.formData.neiosCheckItemNoteList= this.orgList
		},
		//新巡视人若编辑了历史信息则对应巡视人为新巡视人否则保持为原巡视人
		changeCheck(e) {
			this.formData.checkStaffCodeName = this.currentUser.userName
			this.formData.checkStaffCode = this.currentUser.userId;
			this.formData.checkStaffName = this.currentUser.name;
		},
		edit(item, index) {
			
			this.isEdit = true
			this.addOrEdit = true
			this.index = index
			this.formData = JSON.parse(JSON.stringify(item))
			this.formData.checkStaffCodeName = "[" + this.formData.checkStaffCode + "]" + this.formData.checkStaffName
			this.formData.checkDate = this.getTime(new Date(),'day')
		},
		//获取时间
		getTime(myDate, type) {
			var realYear = myDate.getFullYear();
			var myMonth = myDate.getMonth() + 1;
			var realMonth = myMonth;
			var myDay = myDate.getDate();
			var realDay = myDay;
			var myHour = myDate.getHours();
			var realHours = myHour;
			var myMinute = myDate.getMinutes();
			var realMinute = myMinute;
			var mySecond = myDate.getSeconds();
			var realSecond = mySecond;
			if (myMonth < 10) {
				realMonth = "0" + myMonth;
			}
			if (myDay < 10) {
				realDay = "0" + myDay;
			}
			if (myMinute < 10) {
				realMinute = "0" + myMinute;
			}
			if (myHour < 10) {
				realHours = "0" + myHour;
			}
			if (mySecond < 10) {
				realSecond = "0" + mySecond;
			}
			var realDate = realYear + '-' + realMonth + '-' + realDay + ' ' + realHours + ':' + realMinute + ':' +
				realSecond;
			if (type == "sec") {
				realDate = realYear + '-' + realMonth + '-' + realDay + ' ' + realHours + ':' + realMinute + ':' + realSecond;
			} else if (type == "min") {
				realDate = realYear + '-' + realMonth + '-' + realDay + ' ' + realHours + ':' + realMinute;
			} else if (type == "hour") {
				realDate = realYear + '-' + realMonth + '-' + realDay + ' ' + realHours;
			} else if (type == "day") {
				realDate = realYear + '-' + realMonth + '-' + realDay;
			} else if (type == "month") {
				realDate = realYear + '-' + realMonth;
			} else if (type == "year") {
				realDate = realYear;
			}
			return realDate;
		},
		navTo(e, data) {
			if (data) {
				window.localStorage.setItem("itme", JSON.stringify(data))
			} else {
				window.localStorage.setItem("itme", '')
			}
			mui.openWindow({
				url: e,
				id: 'my',
				extras: {
					'item': data
				},
				waiting: {
					autoShow: false
				}
			});
		},
		// 清除隐患描述
		clearDefectInfo() {
			this.showAdd = false
			this.back = false
			this.approveDesc = ''
			this.isApprove = false
		},
		//退回
		saveApprove(){
			if(this.back){
				if(this.approveDesc == ''){
					mui.toast('请输入审批意见')
					return
				}
				var param = {
					approveDesc:this.approveDesc,
					forwardNode:'1',
					nodeDealStaffCode:this.currentUser.userId,
					nodeDealStaffName:this.currentUser.name,
					nodeDealStaffRole:'1',
					nodeVisibleRange:"20",
					workDesc:this.workDesc,
					workId:this.workId,
					workType:'0113'
				}
				console.log(JSON.stringify(param))
				mui.neiosRequst.httpRequst('/app/personWork/sendBack', param,
										(data)=> {
										if(data.code == 0) {
										mui.toast('操作成功')	
												setTimeout(()=> {
													this.goBack()
												}, 1000);
												}
										},
										function(data) {
									
										})
				
			}
			else{
				var param = {
					approveDesc:this.approveDesc,
					companyCode:this.currentUser.companyCode,
					stationCode:this.currentUser.stationCode,
					workDesc:this.workDesc,
					workId:this.workId,
					workType:'0113'
				}
				mui.neiosRequst.httpRequst('/app/regularWork/lifeWater/approveLifeWaterCheck', param,
										(data)=> {
												if(data.code == 0) {
										mui.toast('操作成功')	
												setTimeout(()=> {
													this.goBack()
												}, 1000);
												}
										},
										function(data) {
									
										})
			}
		},
		//退回显示
		showsendBack(e){
			var _this = this
			if(e != 'approve'){
					this.back = true
			}
				_this.neiosLifeWaterInfo.map(v => {
				    v.neiosCheckItemNoteList.map(item => {
						
				        if (item.checkItemResult == '0') {
				            _this.questionArrary.push({ "name": `${v.deviceName},检查项:${item.checkItemContent},不合格`,checkItemNoteId:item.checkItemNoteId});
						
				        }
						
				    });
						
				})
				this.isApprove = true
		},
		   // 新增生活消防水参数
		
		        buildSaveParam() {
		
		            let _this = this;
		
		            // 批次id
		
		            let lifeWaterId = '';
		
		            // 批次id为空代表点击的是新增
					
		            if (_this.lifeWaterId == '') {
		
		                // 批次id
		
		                lifeWaterId = mui.neiosCommon.getUuidv4();
		
		                _this.lifeWaterId = lifeWaterId;
		
		                // 生活/消防水设备检查批次
						_this.neiosLifeWater = {
							lifeWaterId:lifeWaterId,
							workId:this.workId,
							client: 'NEIOS',
							dataSource:'NEIOS_APP'+localStorage.getItem("currVersion"),
							status:'21',
							dataStatus:'1',
							createBy:this.currentUser["userId"],
							createDate:this.nowDate,
							createStaffName:this.currentUser["name"],
							modifyBy:this.currentUser["userId"],
							modifyDate: this.nowDate,
							modifyStaffName:this.currentUser["name"],
							areaCompanyCode:this.currentUser["companyCode"],
							stationCode:this.currentUser["stationCode"],
							newAreaCode:this.currentUser["companyNewCode"],
							newStationCode:this.currentUser["stationNewCode"]
						}
		
		
		            } else {
		
		                // 点击修改，id用原有的
		
		                lifeWaterId = _this.lifeWaterId;
		
		            }
		
		            // 生活/消防水设备明细
		
		            _this.neiosLifeWaterInfo.forEach(lifeWaterInfo => {
					if(lifeWaterInfo.lifeWaterInfoId == ''){
						lifeWaterInfo.lifeWaterInfoId = mui.neiosCommon.getUuidv4()
					}
		                lifeWaterInfo.flag = '';// 保存后把新增的标记置为空
		
		                lifeWaterInfo.lifeWaterId = lifeWaterId;// 关联的批次id
		
		                lifeWaterInfo.status = '21';
		
		                // lifeWaterInfo.checkStaffCode = _this.currentUser["userId"];//检查人
		
		                // lifeWaterInfo.checkStaffName = _this.currentUser["name"];
		
		                //检查项记录
		
		                lifeWaterInfo.neiosCheckItemNoteList.forEach(checkItemNote => {
		
		                    checkItemNote.checkItemNoteId = mui.neiosCommon.getUuidv4()//主键id
		
		                    checkItemNote.busiInfoId = lifeWaterInfo.lifeWaterInfoId;// 关联的明细id
		
		                    checkItemNote.orgCode = _this.currentUser["stationNewCode"];
		
		                    checkItemNote.workType = '0113';
		
		                    checkItemNote.client = 'NEIOS';// 客户id
		
		                    checkItemNote.dataSource = 'NEIOS_APP'+localStorage.getItem("currVersion");// 数据来源
		
		                    checkItemNote.status = '21';
		
		                    checkItemNote.dataStatus = '1';// 数据状态
		
		                    checkItemNote.createBy = _this.currentUser["userId"];// 创建人
		
		                    checkItemNote.createDate = this.nowDate;//创建时间
		
		                    checkItemNote.createStaffName = _this.currentUser["name"];//创建人姓名
		
		                    checkItemNote.modifyBy = _this.currentUser["userId"];//修改人
		
		                    checkItemNote.modifyDate = this.nowDate;//修改时间
		
		                    checkItemNote.modifyStaffName = _this.currentUser["name"];//修改人姓名
		
		                });
		
		            });
		
		        },
		
		// 提交
		submit: function () {
		            let _this = this;
		
		            if (_this.neiosLifeWaterInfo.length == 0) {
		
		                mui.toast('请添加检查项目')
		
		                return;
		
		            }
		
		            let flag = false;
		
		            _this.neiosLifeWaterInfo.map(v => {
					
		                if (v.deviceState === null || v.deviceState === '' || v.deviceState === undefined) {	
				
							 flag = true;
		
		                }
						
						
		            })
		
		            if(flag){
		
		                mui.toast('请完善信息')
		
		                return;
		
		            }
		
		            _this.neiosLifeWaterInfo.map(v => {
						
		                v.neiosCheckItemNoteList.map(item => {
		
		                    if (item.checkItemResult == '0') {
		                        _this.questionArrary.push({ "name": `${v.deviceName},检查项:${item.checkItemContent},不合格`,checkItemNoteId:item.checkItemNoteId });
		
		                    }
		
		                });
		
		            })
					this.showAdd = true
		        },
					//获取多人员姓名
						filterNanme(e){
							var arr = e.split(',')
							var list = []
							arr.forEach(item=>{
								list.push(item.split(']')[1])
							})
							return list.join(',')
						},
		//提交表单
		submitForm(){
			if(this.$refs.personselect.person == ''){
				mui.toast('请选择审批人')
				return
			}
			if(this.lifeWaterId == ''){
				this.lifeWaterId =  mui.neiosCommon.getUuidv4()
			}
			this.neiosLifeWaterInfo.forEach(e=>{
				e.lifeWaterId = this.lifeWaterId
			})
			var param = {
				currentUser:this.currentUser,
				lifeWaterId:this.lifeWaterId,
				nodeDealStaffCode:this.$refs.personselect.personids,
				nodeDealStaffName:this.filterNanme(this.$refs.personselect.person),
				workType:'0113',
				questionArr:this.questionArrary,
				neiosLifeWater:{
					client:"NEIOS",
					createBy:this.currentUser.userId,
					createDate:this.nowDate,
					createStaffName:this.currentUser.name,
					dataSource:"NEIOS_APP"+localStorage.getItem("currVersion"),
					dataStatus:"1",
					lifeWaterId:this.lifeWaterId,
					modifyBy:this.currentUser.userId,
					modifyDate:this.nowDate,
					modifyStaffName:this.currentUser.name,
					remark:null,
					reserveField1:null,
				    reserveField2:null,
					reserveField3:null,
					reserveField4:null,
					status:"32",
					workDesc:this.workDesc,
					workId:this.workId,
					//中台编码
							
					areaCompanyCode :this.currentUser["companyCode"],
							
					stationCode :this.currentUser["stationCode"],
							
							
							
					//新能源编号
							
					newAreaCode :this.currentUser["companyNewCode"],
							
					newStationCode :this.currentUser["stationNewCode"],
							
					

				} ,
				neiosLifeWaterInfo:this.neiosLifeWaterInfo,
				}
				console.log(JSON.stringify(param))
				
				mui.neiosRequst.httpRequst('/app/regularWork/lifeWater/submitLifeWater', param,
										(data)=> {
										mui.toast('操作成功')	
												setTimeout(()=> {
													this.goBack()
												}, 1000);
										},
										function(data) {
									
										})
		},
				
		// 保存
		save(saveOrSubmit) {

            let _this = this;

            if (_this.neiosLifeWaterInfo.length == 0) {
			mui.toast('请添加消防水设备')
                return;
            }

            _this.buildSaveParam();

            let params = {

                lifeWaterId: _this.lifeWaterId,//批次id

                saveOrSubmit: saveOrSubmit,//保存还是提交

                currentUser: _this.currentUser,// 登录人信息

                neiosLifeWater: _this.neiosLifeWater,//批次

                neiosLifeWaterInfo: _this.neiosLifeWaterInfo.concat(_this.delNeiosLifeWaterInfo)// 明细

            };
			
			console.log(JSON.stringify(params))
			// return
            	mui.neiosRequst.httpRequst('/app/regularWork/lifeWater/saveOrUpdateLifeWater', params,
            							(data)=> {
            							mui.toast('操作成功')	
            									setTimeout(()=> {
            										this.goBack()
            									}, 1000);
            							},
            							function(data) {
            						
            							})
        },
		//返回
		returnback(){
				mui.back()
		},
		//返回上一页
		goBack() {
			let page2 = plus.webview.getWebviewById("../sitOperation/terminalwork/terminalwork.html");
			let param = {}
			param.isRefresh = true
			mui.fire(page2, 'isRefresh', param);
			mui.back()
		},
		//新巡视人若编辑了历史信息则对应巡视人为新巡视人否则保持为原巡视人
		changeCheck() {
			this.formData.checkStaffCode = this.currentUser['userId'];
			this.formData.checkStaffName = this.currentUser['name'];
			this.formData.checkStaffCodeName = this.currentUser['userName'];
		},
		yesNoChange() {
			if(this.formData.deviceCode == '' || this.formData.deviceName == ''){
				mui.toast('请输入设备名称编号')
				return
			}
			var right = true
			let log = '[' + this.formData.deviceCode + ']' + this.formData.deviceName + ':';
			var arr = this.formData.neiosCheckItemNoteList
			arr.forEach(e=>{
				if(e.checkItemResult != ''){
					if(e.checkItemResult == 0){
					right = false
					log += e.checkItemContent + (e.checkItemRequirement == null ? '':e.checkItemRequirement) + ';'
					this.formData.deviceState = 1
					}
				}
			})
			if(right){
				log = '设备正常'
				this.formData.deviceState = 0
			}
			this.$set(this.formData,"defectDesc",log)
		},
		//点击菜单
		menuClick(e) {
			this.navTo(e.path)

		},
		//左上角菜单显示隐藏
		showMenulist() {
			this.showMenu ? this.showMenu = false : this.showMenu = true
		},
		//切换筛选条件
		changeFliter(e) {
			this.filterText = e
		},
		showPop() {
			this.show_popup = true
		},
		hidePopup() {
			this.show_popup = false
		},
		// 删除
		del(item,index) {
		
		            let _this = this;
			var btnArr = ['确认', '取消'];
			mui.confirm('确认删除吗?', '操作提示', btnArr, function(e) {
					if(e.index == 0) {
		                    // 是否为页面新增的数据
		                    if (item.flag == 'newSave') {
								_this.neiosLifeWaterInfo.splice(index,1)
		
		                    } else {
		                        // 不是页面新增的数据 删除状态置为0 修改数据库
		
		                        item.dataStatus = '0';// 数据状态
		
		                        item.modifyBy = _this.currentUser["userId"];//修改人
		
		                        item.modifyDate =this.nowDate;//修改时间
		
		                        item.modifyStaffName = _this.currentUser["name"];//修改人姓名
		
		                        _this.delNeiosLifeWaterInfo.push(item);
		
		                        _this.neiosLifeWaterInfo.splice(index,1)
		
		                    }
						}
						})
		        },

	}

})



// mui.init({
// 	pullRefresh: {
// 		container: "#scroll", //待刷新区域标识，querySelector能定位的css选择器均可，比如：id、.class等
// 		down: { //下拉刷新
// 			style: 'circle',
// 			height: 50, //可选,默认50.触发下拉刷新拖动距离,
// 			auto: false, //可选,默认false.首次加载自动下拉刷新一次
// 			contentdown: "下拉可以刷新", //可选，在下拉可刷新状态时，下拉刷新控件上显示的标题内容
// 			contentover: "释放立即刷新", //可选，在释放可刷新状态时，下拉刷新控件上显示的标题内容
// 			contentrefresh: "正在刷新...", //可选，正在刷新状态时，下拉刷新控件上显示的标题内容
// 			callback: async function() { //必选，刷新函数，根据具体业务来编写，比如通过ajax从服务器获取新数据；
// 				page = 0;

// 				////没有更多内容了，endPulldown 传入true， 不再执行下拉刷新
// 				mui('#scroll').pullRefresh().endPulldownToRefresh();
// 				mui('#scroll').pullRefresh().enablePullupToRefresh();
// 				mui('#scroll').pullRefresh().endPullupToRefresh(true);
// 			}
// 		},
// 		up: { //上拉加载
// 			height: 50, //可选.默认50.触发上拉加载拖动距离
// 			auto: false, //可选,默认false.自动上拉加载一次
// 			contentrefresh: "正在加载...", //可选，正在加载状态时，上拉加载控件上显示的标题内容
// 			contentnomore: '没有更多数据了', //可选，请求完毕若没有更多数据时显示的提醒内容；
// 			callback: async function() { //必选，刷新函数，根据具体业务来编写，比如通过ajax从服务器获取新数据；

// 			}
// 		}
// 	}
// });
